package framework.formfields;

import java.lang.reflect.Field;
import java.text.SimpleDateFormat;

import framework.FormField;

public class FormDateField extends FormField {

	public FormDateField(Field field, String label) throws SecurityException,
		NoSuchFieldException {
		super(field, label);
	}

	public String gerarLinha(Object objeto) throws Exception, Throwable {
		SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");  
		return "<tr> <td>" + getLabel() + "</td>" + "<td><INPUT TYPE=\"DATE\" NAME=\"" + getField().getName() + "\" VALUE=\"" + 
			formatter.format(getField().get(objeto)) + "\"</td> </tr>\n";
	}
}
